package com.gao.hookDemo

import com.android.build.gradle.AppExtension
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.plugins.ExtensionContainer


/**
 * 文件名：AsmOlugin <br/>
 * 描述：TODO
 *
 * @author king
 * @since 2022/06/13 18:21
 */
class AsmPlugin : Plugin<Project> {
    override fun apply(p0: Project) {
        println("我是插件")
        val extensionContainer: ExtensionContainer = p0.extensions
        //获取谷歌提供的android配置项的Bean：AppExtension
        val appExtension = extensionContainer.findByType(AppExtension::class.java) as AppExtension
        //注册了谷歌提供的监听class文件转成dex文件的方法。传入PKTransform去处理
        appExtension.registerTransform(TestMethodPlugin())
        println("插件插入完成")
    }
}